/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.myapp.struts.Administrator.UserAdmin;

import com.myapp.model.usuarios.Usuarios;
import com.myapp.svc.Administrator.Users.AdminUserSvc;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 *
 * @author Tarde
 */
public class DeleteUserAdminAction extends org.apache.struts.action.Action {

    /* forward name="success" path="" */
    private static final String SUCCESS = "success";

    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        Integer id =Integer.parseInt(request.getParameter("idusuario"));
        Usuarios u = new Usuarios();
        u.setIdusuario(id);
        AdminUserSvc svc = new AdminUserSvc();
        svc.deleteUser(u); // Cambiamos el estado del usuario a desactivado
                
        return mapping.findForward(SUCCESS);
    }
}
